<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
    <script type="text/javascript">


        $(function () {//页面加载结束

            // 基于准备好的dom，初始化echarts实例
            var myChart = echarts.init(document.getElementById('main'));

            // 指定图表的配置项和数据
            var option = {
                title: {
                    text: '世界疫情Top10'
                },
                tooltip: {},
                legend: {
                    data:['新增']
                },
                xAxis: {
                    // data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
                    data: []
                },
                yAxis: {},
                series: [{
                    name: '病例',
                    type: 'bar',
                    // data: [5, 20, 36, 10, 10, 20]
                    data: []
                }]
            };

            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);

            //发送请求
            var  url = "http://localhost:8080/project1/test3"
            var paramter = ""
            var func =function(data){

                for (var i =0;i < data.length;i++){
                    option.xAxis.data.push(data[i].name)
                    option.series[0].data.push(data[i].nums)
                }
                myChart.setOption(option);
            }
            var type="json"
            $.get(url,paramter,func,type);


        })
    </script>
</head>
<body>
    <div id="main" style="width: 600px;height:400px;"></div>
</body>
</html>